package cn.mcsys.viewer.core.utils.conf;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 读取wechat.properties文件的属性
 */
public class WechatConfig {

    private static String token ;

    private static String appid;

    private static String appsecret;

    private static String psb_appid;

    private static String psb_appsecret;

    private static String rta_appid;

    private static String rta_appsecret;

    static{
        InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("wechat.properties");
        Properties properties = new Properties();

        try {
            properties.load(in);
            token = properties.getProperty("wechat.token");
            appid = properties.getProperty("wechat.appid");
            appsecret = properties.getProperty("wechat.appsecret");
            psb_appid = properties.getProperty("wechat.appid.PSB");
            psb_appsecret = properties.getProperty("wechat.appsecret.PSB");
            rta_appid = properties.getProperty("wechat.appid.RTA");
            rta_appsecret = properties.getProperty("wechat.appsecret.RTA");
        } catch (IOException e) {
            e.printStackTrace();
        }finally{
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static String getToken() {
        return token;
    }

    public static String getAppid(String state) {

        return appid;
    }

    public static String getAppsecret() {
        return appsecret;
    }

    public static String getAppid() {
        return appid;
    }

    public static String getPsb_appid() {
        return psb_appid;
    }

    public static String getPsb_appsecret() {
        return psb_appsecret;
    }

    public static String getRta_appid() {
        return rta_appid;
    }

    public static String getRta_appsecret() {
        return rta_appsecret;
    }
}
